<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <script>
        //数组去重
        var arr = [1,1,1,1,1,1,111,111,111,12312,12351,111,34,23,43,34323,323,323,323,323];
        //sort   filter
        function clean(arr){
            var newArr = arr.concat().sort();
            return newArr.filter(function(v,i){
                return v !== newArr[i+1];
            });
        }
        //indexOf lastIndexOf  sort
        function clear2(arr){
            var newArr = arr.concat();
            newArr.forEach(function(v,i){
                if(newArr.indexOf(v) !== newArr.lastIndexOf(v)){
                    newArr[i] = null;
                }
            });
            return newArr.filter(function(v){
                return v;
            });
        }
        //基础
        function clean3(arr){
            var newArr =[];
            for(var i = 0; i < arr.length; i++){
                if(newArr.indexOf(arr[i]) === -1){
                    newArr.push(arr[i]);
                }
            }
            return newArr;
        }
    </script>
</body>
</html>